<?php
        require_once('../inc/status.php');
        require_once('../inc/logins.php');
        RequireLogin();
        $results = getStatus();
?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link type="text/css" rel="stylesheet" href="../inc/bootstrap.css" />
<link rel="stylesheet" type="text/css" href="http://ajax.aspnetcdn.com/ajax/jquery.dataTables/1.9.4/css/jquery.dataTables.css" />
<title>Database Access: Status</title>
</head>

<body>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js">
</script>
	
	 <div class="container">
		 <? include('../inc/header.php'); ?>
                        <? include('../inc/nav.php'); ?>
            <div id="contents">
	
	<? if(isset($_GET['inserted'])): ?>
                        <div class="alert alert-success">
                        <button class="close">×</button>
                        Record inserted succesfuly.
                    </div>
                <? endif; ?>

	
	 <a href="edit.php" class="add-link">+ Add New Status</a>
	 <form method="post" action="edit.php">
	 <table class="table table-striped table-bordered table-condensed table-hover">
            <thead>
            <tr>
                <th>Status_ID</th><th>Status Name</th><th>Actions</th>
            </tr>
            </thead>
        	<tbody>
            <? while($rs = $results->fetch_assoc()): ?>
                <tr class="<?=$rs['status_ID'] == $_GET['inserted'] ? 'info' : ''?>">
                    <td><?=$rs['status_ID']?></td>
                    <td><?=$rs['statusName']?></td>
                    <td>
                    	<!--<a href="details.php?id=<?=$rs['status_ID']?>">Details</a>-->
						<a href="edit.php?id=<?=$rs['status_ID']?>" class="edit-link">Edit</a>   
                    	<a href="delete.php?id=<?=$rs['status_ID']?>" class="delete-link">Delete</a>
                    </td>
                </tr>
            <? endwhile; ?>
            </tbody>
        </table>
        </form>
      </div>
      </div>
      
			<div class="modal hide fade">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
                    <h3>Delete</h3>
                </div>
                <div class="modal-body"></div>
            </div>
			
		<? include("../inc/jQueryStart.php")?>;
</body>

</html>
